package com.android.settings.audio.peq.peq.filter;

import android.util.ArrayMap;

import java.util.Map;

/**
 * Created by We on 2023/3/18
 */
public class FilterManager {
    private FilterManager() {
        init();
    }

    private static final class InstanceHolder {
        private static final FilterManager instance = new FilterManager();
    }

    public static FilterManager getInstance() {
        return InstanceHolder.instance;
    }

    private Map<FilterType, IFilter> filters = new ArrayMap<>();

    private void init() {
        register(FilterType.LOW_SHELF, new FilterLowShelf());
        register(FilterType.PEAKING, new FilterPeaking());
        register(FilterType.HIGH_SHELF, new FilterHighShelf());
    }

    public void register(FilterType filterType, IFilter filter) {
        this.filters.put(filterType, filter);
    }

    public IFilter getFilter(FilterType filterType) {
        return this.filters.get(filterType);
    }
}
